{include file="public/nheader" /}
<div class="layui-fluid layui-bg-white">
  <form action="{:url()}" class="layui-form layui-form-fixed">
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>参数名称
      </label>
      <div class="layui-input-block">
        <input type="text" required="" lay-verify="required" autocomplete="off" class="layui-input"
          value="{$row.remark|default=''}" placeholder="" disabled>
      </div>
    </div>
    {if !empty($row.name) && ($row.name == 'sfxy' || $row.name == 'myus' || $row.name == 'hdsm' || $row.name == 'ydgzh' || $row.name == 'sfys')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>内容
      </label>
      <div class="layui-input-block">
        <textarea id="value" name="value" />{$row.value|default=''}</textarea>
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'withfee')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>手续费(单位%)
      </label>
      <div class="layui-input-block">
        <input type="number" required="" lay-verify="required" autocomplete="off" class="layui-input"
          value="{$row.value|default=''}" name="value" {$row.value|default='' } placeholder="0-100,最多保留2位小数">
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'nyqcoun')}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>新用户首单仅需支付金额
      </label>
      <div class="layui-input-block">
        <input type="number" required="" lay-verify="required" autocomplete="off" class="layui-input"
          value="{$row.value|default=''}" name="value" {$row.value|default='0' } placeholder="">
      </div>
    </div>
    {elseif !empty($row.name) && ($row.name == 'yqcoun')}
    <div class="layui-card layui-form">
      <label class="layui-form-label">
        赠送优惠券
      </label>
      <div class="layui-card-body">
        <div class="layui-input-block">
          <a class="layui-btn layui-btn-btn layui-btn-sm layui-btn-normal" onclick="addtable2()">添加</a>
          <table class="layui-table layui-form" style="border:1px solid #ccc;" id="table2" lay-filter="table2">
            <thead>
              <tr>
                <td>
                  <div class="layui-table-cell">需要达到使用金额(单位:元)</div>
                </td>
                <td>
                  <div class="layui-table-cell">抵扣金额(单位:元)</div>
                </td>
                <td>
                  <div class="layui-table-cell">有效时长(单位:天)</div>
                </td>
                <td>
                  <div class="layui-table-cell">操作</div>
                </td>
              </tr>
            </thead>
            <tbody>
              {if !empty($row.value)}
              {foreach $row.value as $k => $v}
              <tr>
                <td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input"
                    name="value[{$k}][getmoney]" value="{$v.getmoney}">
                </td>
                <td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input"
                    name="value[{$k}][money]" value="{$v.money}">
                </td>
                <td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input"
                    name="value[{$k}][days]" value="{$v.days}">
                </td>
                <td>
                  <a class="layui-btn layui-btn-danger layui-btn-xs del2">删除</a>
                </td>
              </tr>
              {/foreach}
              {/if}
            </tbody>
          </table>
        </div>
      </div>
    </div>
    {else}
    <div class="layui-form-item">
      <label class="layui-form-label">
        <font color="red">* </font>内容
      </label>
      <div class="layui-input-block">
        <input type="text" id="name" name="value" required="" lay-verify="required" autocomplete="off"
          class="layui-input" value="{$row.value|default=''}" placeholder="">
      </div>
    </div>
    {/if}
    <div class="layui-footer layui-form-item layui-center ">
      <input type="hidden" value="{$row['name']|default=''}" name="name" />
      <button class="layui-btn" lay-filter="submitIframe" type="button" lay-submit>提交</button>
      <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">取消</button>
    </div>
  </form>
</div>
{include file="public/nfooter" /}
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script>
  layui.use(['form', 'jquery', 'admin', 'content'], function () {
    var form = layui.form;
    var admin = layui.admin;
    var jquery = layui.jquery;

    // 渲染富文本编辑器
    var content = layui.content;
    content.tinymce('value');
  });
  function addtable2() {
    var i = $('#table2 tbody tr').length;
    //你要添加的html
    var html = '<tr>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][getmoney]" value=""></td>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][money]" value=""></td>' +
      '<td><input required="" lay-verify="required" type="text" id="layui-input" class="layui-input" name="value[' + i + '][days]" value=""></td>' +
      '<td><a class="layui-btn layui-btn-danger layui-btn-xs del2" >删除</a></td></tr>';
    $(html).appendTo($('#table2 tbody:last'));
    layui.use(['form'], function () {
      $ = layui.jquery;
      var form = layui.form;
      form.render();
    });
  };
  $('body').on('click', '.del2', function () {
    $(this).closest('tr').remove();
  });
</script>